package com.topInterview;

/**
 * @Author: huangzhigao
 * @Date: 2022/2/23 21:16
 */
public class leecode277_findStar {
    public boolean knows(int x, int y) {
        return true;
    }

    public int getStar(int n) {
        int cand = 0;
        //找出最有可能的明星
        for (int i = 1; i < n; i++) {
            if (knows(cand, i)) {
                cand = i;
            }
        }

        //如果明星认识0-cand的人，则不是明星
        for (int i = 0; i < cand; i++) {
            if (knows(cand, i)) {
                return -1;
            }
        }


        //每个人都认识明星
        for (int i = 0; i < n; i++) {
            if (!knows(i, cand)) {
                return -1;
            }
        }

        return cand;


    }
}
